x86: add volatile prefix for cpuid asm clauses
authorWei Gang <gang.wei@intel.com>
Mon, 14 Mar 2011 17:04:42 +0000 (17:04 +0000)
committerWei Gang <gang.wei@intel.com>
Mon, 14 Mar 2011 17:04:42 +0000 (17:04 +0000)
commit1a048a1d9e37576f4c0e867ba362afbd456555aa
treee8c48efd45280165db6b500f33c9838a272520e5
parent84c4461b7d3a3ea0a082812821018a3e9a9cb12f
x86: add volatile prefix for cpuid asm clauses

cpuid results are possible to be changed now. For example, changing
CR4.OSXSAVE bit or setting MSR XCR_XFEATURE_ENABLED_MASK may change
XSAVE related cpuid leave return values.

The volatile prefix is required to avoid the second cpuid calls
following some possible changing operations being optimized in
incorrect way by compiler.

The sample bug is in xsave_init while debug=3Dn. The second call to
cpuid_count() may be optimized and lead to a BUG_ON case while compare
xsave_cntxt_size with ebx.

Signed-off-by: Wei Gang <gang.wei@intel.com>
xen/include/asm-x86/processor.h